package think.thread.sychron.c01;

public class Car {
	private boolean waxOn = false;

	// 打蜡
	public synchronized void waxed() {
		waxOn = true;
		notifyAll();
	}

	// 抛光
	public synchronized void buffed() {
		waxOn = false;
		notifyAll();
	}

	public synchronized void waitForWaxing() throws Exception {
		while (!waxOn)
			wait();
	}

	public synchronized void waitForBuff() throws Exception {
		while (waxOn)
			wait();
	}

}
